<?php
class Wlib_Controller_Plugin_CheckLogin extends Zend_Controller_Plugin_Abstract {

    public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
    {
        $auth = Zend_Auth::getInstance();
        $moduleName = $this->getRequest()->getModuleName();

        if(!$auth->getIdentity() && $moduleName == 'admin') {
            $request->setModuleName('default')
                ->setControllerName('auth')
                ->setActionName('index')
                ->setDispatched(false);
        }
    }
}
?>